package com.qingcheng.timer;

import com.qingcheng.service.StatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDate;

@Component
public class RegularStatistics {

    @Autowired
    private StatisticsService statisticsService;

    // 每天定时添加统计表数据
    @Scheduled(cron = "0 0 1 * * ?")
    public void createStatisticsRegular(){
        LocalDate date1=LocalDate.now().minusDays(1);
        LocalDate date2=LocalDate.now();
        statisticsService.deal(date1.toString(),date2.toString());
    }

}
